package com.zm.admin.zmeng.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zm.admin.utils.ShellHandleUtil;
import com.zm.admin.zmeng.domain.ZmMonitor;
import com.zm.admin.zmeng.mapper.ZmMonitorMapper;
import com.zm.admin.zmeng.service.ZmAttachmentService;
import com.zm.admin.zmeng.service.ZmMonitorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/***
 *
 * @Auther: MuYun
 * @Date:  2023/12/19 21:27
 * @Description：服务器资源监控service实现类
 *
 */
@Service
public class ZmMonitorServiceImpl extends ServiceImpl<ZmMonitorMapper, ZmMonitor> implements ZmMonitorService {

    @Resource
    public ZmMonitorMapper zmMonitorMapper;

    @Override
    public Map<String, Object> get() {
        Map<String, Object> map = ShellHandleUtil.startMonitor();
        Map<String, Object> retMap = (Map<String, Object>) map.get("data");
        ZmMonitor zmMonitor= (ZmMonitor) map.get("obj");
        zmMonitorMapper.insert(zmMonitor);
        return retMap;
    }
}
